import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/views/layout.vue'
import user from '@/views/user.vue'
import collect from '@/views/collect.vue'
import like from '@/views/like.vue'
import article from '@/views/article.vue'
import login from '@/views/login.vue'
import register from '@/views/register.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: layout,
    redirect: '/article',
    children: [
      { path: 'user', component: user },
      { path: 'collect', component: collect },
      { path: 'like', component: like },
      { path: 'article', component: article }
    ]
  },
  {
    path: '/login',
    component: login
  },
  { path: '/register', component: register }
]

const router = new VueRouter({
  routes
})

export default router
